package com.woniuxy.micromedicalserver.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultMsg implements Serializable {
    private Integer code;		//状态码
    private String message;	//提示信息
    private Object data;			//返回的数据


    //简易的构造方法,用于不用返回data数据的时候 :)
    public ResultMsg(boolean state) {
        super();
        if (state) {
            this.code = 200;
            this.message = " 操作成功 :) ";
        }else {
            this.code = 500;
            this.message = " 操作失败 ::>_<:: ";
        }
    }

    //带data的构造方法,用于需要返回data数据的时候 :)
    public ResultMsg(boolean state, Object data) {
        super();
        if (state) {
            this.code = 200;
            this.message = " 操作成功 :) ";
        }else {
            this.code = 500;
            this.message = " 操作失败 ::>_<:: ";
        }
        this.data = data;
    }



}
